<template>
  <div>
    <el-card style="height: 610px;">
      <quill-editor ref="myQuillEditor"
                    v-model="from.content1"
                    style="height: 500px;"
                    :options="editorOption" />
    </el-card>
    <el-button @click="submit">提交发布：</el-button>
    <el-card style="height: 610px;">
      <div v-html="news" />
    </el-card>
    <el-button @click="getnew">获取新闻：</el-button>
  </div>
</template>

<script>
import newsApi from '@/api/news'

import {
  quillEditor
} from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
export default {
  name: 'FuncFormsEdit',
  components: {
    quillEditor
  },
  data () {
    return {
      from: {
        content1: '9999'

      },
      editorOption: {},
      news: '',
      news_id: 7
    }
  },
  methods: {
    submit () {
      console.log('发布新闻', this.from)
      newsApi.addNewsInfo(this.from)
        .then(response => { // 请求成功
          // response接口返回的数据
          console.log(response)
          // this.list = response.data
          // this.total = response.total
          // console.log(this.list)
          // console.log(this.total)
        })
    },
    getnew () {
      newsApi.getNewsInfoById(this.news_id)
        .then(response => { // 请求成功
          // response接口返回的数据
          console.log(response)
          this.news = response.data[0].content1
          // this.total = response.total
          // console.log(this.list)
          // console.log(this.total)
        })
    }
  }
}

</script>

<style scoped>
</style>
